%%-*-erlang-*-
[
% server configuration
{lorawan_server, [
    % UDP port listening for packets from the packet_forwarder Gateway
    {packet_forwarder_listen, [{port, 1680}]},
    % HTTP port for web-administration and REST API
    {http_admin_listen, [{port, 8080}]},
    % HTTP/SSL port
    {http_admin_listen_ssl, [
        {port, 8443},
        {certfile, "cert.pem"},
        {cacertfile, "cacert.pem"},
        {keyfile, "key.pem"}
    ]},
    % Enable this line for the Newly added cluster nodes
    % {db_master, 'lorawan@yourhost'},
    % redirect all http traffic to https (when both http and https are enabled)
    {http_admin_redirect_ssl, true},
    % default username and password for the admin interface
    {http_admin_credentials, {<<"admin">>, <<"admin">>}},
    % headers to be added to each HTTP response
    {http_extra_headers, #{
        % <<"access-control-allow-origin">> => <<"http://127.0.0.1:3000">>,
        % <<"access-control-allow-credentials">> => <<"true">>,
        % <<"access-control-allow-methods">> => <<"OPTIONS, GET, PUT, POST, DELETE">>,
        % <<"access-control-allow-headers">> => <<"content-type">>,
        % <<"access-control-expose-headers">> => <<"x-total-count">>
        % <<"content-security-policy">> => <<"default-src * data: 'unsafe-inline' 'unsafe-eval';">>
    }},
    {http_custom_web, [
    % enable this to serve additional web-pages
    %    {"/www", file, <<"/var/www/html/index.html">>, [{<<"anonymous">>, '*'}]},
    %    {"/www/[...]", dir, <<"/var/www/html">>, [{<<"anonymous">>, '*'}]}
    ]},
    % Enable the following line to export statistics metrics in Prometheus format
    % {enable_prometheus, true},
    % amount of rxframes retained for each device/node
    {retained_rxframes, 50},
    % websocket expiration if client sends no data
    {websocket_timeout, 3600000} % ms
]},
{os_mon, [
    % Setting this parameter to true can be necessary on embedded systems with
    % stripped-down versions of Unix tools like df.
    {disksup_posix_only, false}
]},
% error logging settings
{lager, [
    {colored, true},
    % uncomment to display even a high number of messages per second
    % see https://github.com/erlang-lager/lager#overload-protection
    % {error_logger_hwm, undefined},
    {handlers, [
        % {lager_console_backend, [{level, debug}]},
        {lager_file_backend, [{file, "debug.log"}, {level, debug}]},
        {lager_file_backend, [{file, "error.log"}, {level, error}]}
    ]},
    {crash_log, "crash.log"}
]},
{sasl, [
    {errlog_type, error}
]}].
